/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package DomainModel;

/**
 *
 * @author PRATAP
 */
public class Course 
{
    private int courseId;
    private String courseCode;
    private String courseName;
    private int creditHours;
    
    
    public Course(int pCourseId, String pCourseCode, String pCourseName, int pCreditHours){
        this.courseId = pCourseId;
        this.courseCode = pCourseCode;
        this.courseName = pCourseName;
        this.creditHours = pCreditHours;
    }
            
    public int getCourseId() {
        return courseId;
    }
    
    public String getCourseCode() {
        return courseCode;
    }
    
    public String getCourseName(){
        return courseName;
    }
    
    public int getCreditHours(){
        return creditHours;
    }
    
    public void setCourseId(int courseId){
        this.courseId = courseId;
    }
    
    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public void setCreditHours(int creditHours) {
        this.creditHours = creditHours;
    }

    public String validate() {
        String errMsg = "";
        if (courseCode == null || courseCode.isEmpty()) {
            errMsg = "Course Code cannot be empty. ";
        }
        
        if (courseName == null || courseName.isEmpty()) {
            errMsg += "Course Name cannot be empty. ";
        }
        
        if (creditHours < 1 || creditHours >  4) {
            errMsg += "Credit Hours must be between 1 and 4.";
        }
        
        return errMsg;
    }
}
